home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
DONALDXC
/
BLESSED_.C
next >
Wrap
C/C++ Source or Header
|
1990-05-01
|
2KB
|
62 lines
/********************************/
/* File: Blessed Folder.c */
/* */
/* Given the name of a volume */
/* in params[0] */
/* returns the id of the */
/* blessed folder. */
/* ---------------------------- */
/* Based on tech note #129 */
/* by Jim Friedlander */
/********************************/
#include <MacTypes.h>
#include <OSUtil.h>
#include <MemoryMgr.h>
#include <FileMgr.h>
#include <ResourceMgr.h>
#include <pascal.h>
#include <hfs.h>
#include <string.h>
#include "HyperXCmd.h"
#include "HyperUtils.h"
#define nil 0L
char colon[2] = "\p:";
pascal void main( paramPtr )
XCmdBlockPtr paramPtr;
{
long sid; /*** id of blessed ("system") folder ***/
HParamBlockRec theHPB; /*** needed to get the id of blessed ***/
CInfoPBRec theCPB; /*** needed to reconstruct path name ***/
char vName[256]; /*** name of volume we're checking ***/
char fullPath[256];
OSErr err;
HLock( paramPtr->params[0] );
ZeroToPas( paramPtr, *(paramPtr->params[0]), &vName );
HUnlock( paramPtr->params[0] );
/*** Given the name of a volume, try to get the ***/
/*** the volume reference number ***/
theHPB.volumeParam.ioNamePtr = (StringPtr)vName;
theHPB.volumeParam.ioVRefNum = (short)0;
theHPB.volumeParam.ioVolIndex = -1;
err = PBHGetVInfo( &theHPB, 0);
fullPath[0] = '\0';
if ( !err ){
theCPB.dirInfo.ioFDirIndex = -1;
theCPB.dirInfo.ioDrDirID = theHPB.volumeParam.ioVFndrInfo[0];
theCPB.dirInfo.ioVRefNum = theHPB.volumeParam.ioVRefNum;
fullPath[0] = '\0';
ClimbTree( theCPB.dirInfo.ioDrDirID,(CInfoPBPtr)&theCPB,(char *)fullPath );
}
paramPtr->returnValue = PasToZero( paramPtr, fullPath );
}